package com.pwt.repository;

import com.pwt.common.ResultPage;
import com.pwt.entity.PowerModule;
import com.pwt.entity.WERTEVAR;
import com.pwt.model.*;
import com.pwt.model.crustallus.*;
import com.pwt.model.crustallus.FeatureModel;
import com.pwt.model.what.CharacteristicsModel;
import com.pwt.model.what.HeaderModel;
import com.pwt.model.what.OverviewModel;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author dw
 * @version 1.0.0
 * @date 2021/9/23
 */
public interface WERTEVARRepositoryExtension {

    List<PowerModule> queryMASCHINE(String beginTime, String endTime);

    HeaderModel getHeader(String k0014, Integer k0010);

    String hasError(String k0014, Integer k0010);

    ResultPage<CharacteristicsModel> getList(String k0014, Integer k0010,Integer page,Integer limit);

    List<Double> getMeasuredValue(Integer k1000,Short k2000,Integer k0010);

    List<Double> getMeasureValueOnMonth(Integer k1000,Short k2000,Integer month);

    List<Double> getMeasureValueOnTop(Integer num,Integer k1000,Short k2000);


    /**
     * 查询最大值 最小值 的被测参数
     * @param k0014
     * @param page
     * @param limit
     * @return
     */
    ResultPage<CharacteristicsModel>  getMaxAndMinCharacteristics(String k0014, Integer k0010,Integer page,Integer limit);

    List<ChartValueModel> getListsAllValues(Integer k1000, Short k2000, Integer k0010, String k0014, Integer top);

    public List<Double> getWertOrderByK0014(Integer k1000, Short k2000, Integer k0010, String k0014);

    ResultPage<OverviewModel> getOverviewModel(String k0014, Integer k0010, Integer page, Integer limit);


    ResultPage<OverviewModel>  getCharacteristicsSigmaByOrderId(String k0053 ,Integer k1000, Integer k0010,String startTime, String endTime,Integer page, Integer limit);

    LusHeaderModel getLusHeader(String k0053 , Integer k1000, Integer k0010,String startTime, String endTime);

    List<ParameterModel> getCharacteristicsInHeader(String k0053, Integer k1000, Integer k0010);

    List<BoxModel> getBoxCharacteristics(String k0053, Integer k1000,Integer k2000, Integer k0010,String startTime,String endTime);

    List<Double> getTestValue(String k0053,Integer k1000,Short k2000,Integer k0010,String startTime,String endTime);

    List<ChartValueModel>  getOrderList(Integer k1000, Short k2000, Integer k0010,String k0053,String startTime,String endTime);

    FeatureModel getCharacteristics(Integer k1000, Short k2000);

    List<OrderModel> getOrderListNew(String filters, Integer machineId,Integer k1000 ,String startTime, String endTime);

    public List<OverviewModel> getCharacteristicsByOrderId(Short filter, Integer machineId, String startTime, String endTime,String k0053,Integer k1000);

    public List<Double> getValueByOrderId(Integer machineId,Integer k1000,Short k2000, String startTime, String endTime,String k0053);

    /**
     * 根据工序 机器id 过滤器 工序分组
     * @param filters
     * @param machineIds
     * @param startTime
     * @param endTime
     * @return
     */
    public List<GroupModel> getMachineGroupModer(String filters, Set<Integer> machineIds, String startTime, String endTime);

    public List<GroupModel> getMachineGroupModer(String filters , Set<Integer> machineIds,Set<Integer> parts,Set<Integer> nests, String startTime, String endTime);

    /**
     * 根据工序 机器id 过滤器 机器分组
     * @param filters
     * @param machineIds
     * @param startTime
     * @param endTime
     * @return
     */
    public List<GroupModel> getMachineGroupModerList(String filters,Set<Integer> machineIds, String startTime, String endTime);

    /**
     * 根据工序 机器id 过滤器 零件类型分组
     * @param filters
     * @param machineId
     * @param startTime
     * @param endTime
     * @return
     */
    public List<GroupModel> getPartGroupModerList(String filters, Integer machineId, String startTime, String endTime);

    public List<GroupModel> getPartGroupModerList(String filters, Set<Integer> machineIds,Set<Integer> nestIds, String startTime, String endTime);

    /**
     * 根据 工序id，机器id  零件id  查询 被测参数  数据集合
     * @param filters
     * @param machineIds
     * @param partId
     * @param startTime
     * @param endTime
     * @return
     */
    public List<OverviewModel> getCharacteristicsByProcessAndMachine(String filters, Set<Integer> machineIds, Integer partId,String startTime, String endTime);

    public List<OverviewModel> getCharacteristicsByProcessAndMachine(String filters , Set<Integer> machineIds, Set<Integer> partId,String nestIds,String startTime, String endTime);

    /**
     * 根据 工序id，机器id  零件id  查询 被测参数测量值集合
     * @param filters
     * @param machineIds
     * @param partId
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Double> getValueByProcessAndMachine(String filters,Set<Integer> machineIds,Integer partId, String startTime, String endTime);

    public List<Double> getValueByProcessAndMachine(String filters, Set<Integer> machineIds,Set<Integer> partIds,String nestIds, String startTime, String endTime);

    /**
     * 查询角色配置的所有机器 的数据
     * @param machineIds
     * @param filters
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Double> getAllValueByUser(Set<Integer>  machineIds,String filters,String startTime, String endTime);

    public List<GroupModel> getAnalyseNest(String filterId,Set<Integer> machineIds,String partIds,String nestIds,String startTime, String endTime );

    public ResultPage<EventMeasuresModel> getEventMeasures(Integer page,Integer limit);

    //工位生产情况
    public List<ProductionStationModel> productionStation();

    //查询所有被测参数
    public List<OverviewModel> getPartCharacteristics(String k0014);


    public ResultPage<CharacteristicsModel> getCharacteristicsByK0014(String k0014,Integer k0010,Integer page,Integer limit);

    public List<CharacteristicsModel> getCharacteristicsByK0014AndK0010(String k0014,Integer k0010);

    /**
     * 判断是否是曲线
     * @param k0014
     * @param k0010
     * @return
     */
    public Integer hasCurvesFile(String k0014,Integer k0010);

    public List<CharacteristicsModel> querymERKMAL();

    public List<Double> queryLastValueByK1000AndK2000(Integer k1000, Short k2000);

    //查询过限数据
    public CloudMessageModel queryCloudHomeMessage(Integer k1000, Short k2000, Integer k0000);

    //查询零件被测参数信息
    public CharacteristicsModel queryCharacteristicsByK1000AndK2000(Integer k1000,Short k2000);

}
